<?php $__env->startSection('css'); ?>
    <style>
        td {
            width: auto;
        }

        td.min {
            width: 1%;
            white-space: nowrap;
        }
    </style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox-title">
                <h5>每日角色留存</h5>
            </div>
            <div class="ibox-content">
                <form class="form-horizontal " action="<?php echo e(route('stat.retention')); ?>" method="post"
                      enctype="multipart/form-data">
                    <?php echo csrf_field(); ?>

                    <table class="table-striped table-bordered table-hover table-condensed">
                        <tr class="b-group">
                            <td class="b-child" colspan="2">
                                <table class="table-striped table-bordered table-hover table-condensed">
                                    <tr class="b-group">
                                        <td>
                                            <?php echo $__env->make('widget.between_datetime',['showEndTime'=>true], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                        </td>
                                        <td>
                                            <?php echo $__env->make('widget.query_and_refresh', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                        </td>
                                        <td>
                                            <?php echo $__env->make('widget.dataType', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr class="b-group">
                            <th width="10%">
                                <label>全选/不选&nbsp;&nbsp;
                                    <input type="checkbox" checked="checked" value=""
                                           onclick="checkAll(this)"></label>
                            </th>
                            <td class="b-child">
                                <div style="max-height:6.5rem;overflow-y:scroll;">
                                    <?php echo $__env->make('widget.channel', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                </div>
                            </td>
                        </tr>
                        <tr class="b-group">
                            <th width="10%">
                                <label>全选/不选&nbsp;&nbsp;
                                    <input type="checkbox" checked="checked" value="" onclick="checkAll(this)"></label>
                            </th>
                            <td class="b-child">
                                <div style="max-height:10rem;overflow-y:scroll;">
                                    <?php echo $__env->make('widget.server', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                </div>
                            </td>
                        </tr>
                    </table>
                </form>
                <table class="table table-striped table-bordered table-hover m-t-md tblData" data-toggle="table"
                       data-pagination="true">
                    <thead>
                    <tr>
                        <th class="text-center">时间</th>
                        <th class="text-center">新增用户</th>
                        <th class="text-center">老用户</th>
                        <?php
                        $logDay = config('enums.retention_log_day');
                        $html = '';
                        foreach ($logDay as $key => $value) {
                            if ($value == 2) {
                                $html .= <<<EOF
                        <th class="text-center">
                            <a href="javascript:;" data-toggle="popover" data-placement="top"
                               data-html="true" data-trigger="hover"
                               data-content="{$value}日留存率 = {$value}日登录的用户 / 新增用户"
                               title="{$value}日留存率">
                                {$value}日
                            </a>
                        </th>
EOF;
                            } else {
                                $html .= '<th class="text-center">' . $value . '日</th>';
                            }
                        }
                        echo $html;
                        ?>
                    </tr>
                    </thead>
                    <tbody class="text-center">
                    <?php
                    $html = '';
                    foreach ($retention as $key => $value) {
                        $html .= "
                            <tr>
                            <td class='min'>{$value['date']}</td>
                            <td>{$value['new_users']}</td>
                            <td>{$value['old_users']}</td>";

                        foreach ($logDay as $i => $j) {
                            $key = "day_{$j}_active_users";
                            $html .= "<td>{$value[$key]}</td>";
                        }
                        $html .= '</tr>';
                    }
                    echo $html;
                    ?>
                    </tbody>
                </table>
                <div class="pull-right pagination m-t-no">
                    <div class="text-center">
                        
                    </div>
                    <div>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
    <script>
    </script>
    <link href="<?php echo e(loadEdition('/admin/css/plugins/datapicker/bootstrap-datepicker.css')); ?>" rel="stylesheet">
    <link href="<?php echo e(loadEdition('/admin/js/plugins/bootstrap-table/bootstrap-table.min.css')); ?>" rel="stylesheet">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
    <script src="<?php echo e(loadEdition('/admin/js/plugins/datapicker/bootstrap-datepicker.js')); ?>"></script>
    <script src="<?php echo e(loadEdition('/admin/js/plugins/datapicker/bootstrap-datepicker.zh-CN.js')); ?>"></script>

    <script src="<?php echo e(loadEdition('/admin/js/plugins/bootstrap-table/bootstrap-table.min.js')); ?>"></script>
    <script src="<?php echo e(loadEdition('/admin/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js')); ?>"></script>

    <script src="<?php echo e(loadEdition('/js/global.js')); ?>"></script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>